/**
 * Copyright (C) 2015 Coderyuan.com. All Rights Reserved.
 *
 * JustLib
 *
 * SystemManager.java created on 2015年6月21日
 *
 * @author yuanguozheng
 * @since 2015年6月21日
 * @version v1.0.0
 */
package com.coderyuan.utils;

import android.accounts.AccountManager;
import android.annotation.TargetApi;
import android.app.ActivityManager;
import android.app.AlarmManager;
import android.app.NotificationManager;
import android.content.Context;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.wifi.WifiManager;
import android.os.Build;
import android.os.PowerManager;
import android.os.Vibrator;
import android.telecom.TelecomManager;
import android.telephony.TelephonyManager;
import android.view.LayoutInflater;
import android.view.WindowManager;

public class SystemManager {

    private static Context sContext;

    public static void init(Context context) {
        sContext = context;
    }

    public static Context getContext() {
        return sContext;
    }

    public static WifiManager getWifiManager() {
        return (WifiManager) sContext.getSystemService(Context.WIFI_SERVICE);
    }

    public static ConnectivityManager getConnectivityManager() {
        return (ConnectivityManager) sContext.getSystemService(Context.CONNECTIVITY_SERVICE);
    }

    public static PowerManager getPowerManager() {
        return (PowerManager) sContext.getSystemService(Context.POWER_SERVICE);
    }

    public static WindowManager getWindowManager() {
        return (WindowManager) sContext.getSystemService(Context.WINDOW_SERVICE);
    }

    public static LayoutInflater getLayoutInflater() {
        return (LayoutInflater) sContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    public static AccountManager getAccountManager() {
        return (AccountManager) sContext.getSystemService(Context.ACCOUNT_SERVICE);
    }

    public static ActivityManager getActivityManager() {
        return (ActivityManager) sContext.getSystemService(Context.ACTIVITY_SERVICE);
    }

    public static AlarmManager getAlarmManager() {
        return (AlarmManager) sContext.getSystemService(Context.ALARM_SERVICE);
    }

    public static NotificationManager getNotificationManager() {
        return (NotificationManager) sContext.getSystemService(Context.NOTIFICATION_SERVICE);
    }

    public static Vibrator getVibrator() {
        return (Vibrator) sContext.getSystemService(Context.VIBRATOR_SERVICE);
    }

    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public static TelecomManager getTelecomManager() {
        return (TelecomManager) sContext.getSystemService(Context.TELECOM_SERVICE);
    }

    public static TelephonyManager getTelephonyManager() {
        return (TelephonyManager) sContext.getSystemService(Context.TELEPHONY_SERVICE);
    }

    public static LocationManager getLocationManager() {
        return (LocationManager) sContext.getSystemService(Context.LOCATION_SERVICE);
    }
}
